home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- COPYIGHT
-
- ©1995 Dietmar Eilert (e-mail: DIETMAR@TOMATE.TNG.OCHE.DE). All Rights
- Reserved. Code may not be reused/reproduced without written permission of
- the author.
-
- Dietmar Eilert
- Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
- E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
- Tel: +49-(0)241-81665
- +49-(0)2525-7776
- Fax: +49-(0)241-81665
-
- Example: scan handler looking for AutoDoc nodes. Scan handlers are plain
- functions (LoadSeg'ed by GED): no standard C startup code, no library calls.
- This handler is faster than GoldED's built in AutoDoc handler since it simply
- looks for formfeeds. Won't work with all AutoDocs though Commodore's AutoDocs
- are handled properly.
-
- DICE C:
-
- dcc autodocslow.c -// -l0 -md -mRR -o ram:autodocslow
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- #define FORMFEED 12
-
- ULONG
- ScanHandlerGuide(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- const char *version = "$VER: ADocSlow 1.0 (" __COMMODORE_DATE__ ")";
-
- ULONG length;
-
- // look for node header; example: assert/abort assert/abort
-
- for (length = len; length; --length) {
-
- if (**text == '/') {
-
- UWORD keyLen;
- UBYTE *next;
-
- // get description length (leading "/" included).
-
- for (next = *text, keyLen = 0; length && (*next != ' '); --length, ++next)
-
- ++keyLen;
-
- if (keyLen) {
-
- // search for repeated node header
-
- while (length) {
-
- if (*next == '/') {
-
- UWORD compare;
-
- // same node header ?
-
- for (compare = 0; compare < keyLen; ++compare)
-
- if (next[compare] != (*text)[compare])
-
- return(FALSE);
-
- // remove leading "/"
-
- ++*text;
-
- return(keyLen - 1);
- }
-
- --length;
- ++next;
- }
- }
-
- break;
- }
- else
- ++*text;
- }
-
- return(FALSE);
- }
-